/*
 * @Date: 2020-04-19 22:11:17 
 * @Last Modified time: 2020-04-19 22:11:58
 */

export default function(str: string): number {
  const a: string = str.trim()
  const max: number = Math.pow(2, 31) - 1;
  const min: number = -Math.pow(2, 31);
  const num = parseInt(a)
  if (num > max) {
      return max
  }
  if (num < min) {
      return min
  }
  if (isNaN(num)) {
      return 0
  } else {
      return num
  }
}
